<%@ page language="java" import="java.util.*" import="java.sql.*" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>修改电影信息</title>
</head>
<body>
<%
try{
	request.setCharacterEncoding("utf-8");
	Class.forName("com.mysql.jdbc.Driver");
	Connection con=DriverManager.getConnection("jdbc:mysql://localhost:3306/gp","root","123456");
	Statement stmt=con.createStatement();
	String id=request.getParameter("id");
	ResultSet rs=stmt.executeQuery("select * from books where id="+id);
	rs.next();	
%>
<form action="update.jsp" method="post">
<table align="center">
<caption>修改电影信息</caption>
<tr>
<th>编号:</th>
<td><input name="id" type="text" value="<%=rs.getString(1)%>" readonly="readonly"></td>
</tr>
<tr>
<th>电影名称:</th>
<td><input name="name" type="text" value="<%=rs.getString(2)%>"></td>
</tr>
<tr>
<th>主演:</th>
<td><input name="author" type="text" value="<%=rs.getString(3)%>"></td>
</tr>
<tr>
<th>价格:</th>
<td><input name="price" type="text" value="<%=rs.getString(4)%>">元</td>
</tr>
<tr>
	<th colspan="2">
	<input type="submit" value="修改">
	<input type="reset" value="重置">
	</th>	
</tr>
</table>
</form>
<%
	rs.close();
	con.close();
}catch(Exception e){
	out.println("<script>alert('修改失败,请重试');</script>");
	response.setHeader("refresh","1;url=edit.jsp");
} 
%>
</body>
</html>